﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.EntityFrameworkCore;
using Xierun.Models;

namespace Xierun
{
    public class EntityContext:DbContext
    {
        public EntityContext(DbContextOptions<EntityContext> options)
            :base(options)
        {   
               
        }

        public DbSet<Base_User> Base_User { get; set; }

        public DbSet<ChatCommand> ChatCommand { get; set; }

        public DbSet<ChatCommandParam> ChatCommandParam { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<ChatCommand>(entity =>
            {             
                entity.HasIndex(e => e.Name).IsUnique();

            });

            modelBuilder.Entity<ChatCommandParam>(entity =>
            {
                entity.HasIndex(e => e.Name).IsUnique();

            });
            //base.OnModelCreating(modelBuilder);
        }
    }
}
